<?php
namespace app\api\service;
/**
 * Sidebar Service
 * User: zng
 * Date: 2019/10/24
 * Time: 16:25
 */
use app\exceptions\OrdinaryException;
use app\api\model\columns\Sidebar as SidebarModel;
use think\Response;

class Sidebar {

    /**
     * 获取左边栏
     * @author zx
     * @date 2019-10-25
     * @return Response
     */
    public function leftSidebar()
    {
        $cacheKey = 'api_sidebar_list'.date("Ymd");
        $sidebar = SidebarModel::field('id,name')->all(null, '', $cacheKey);
        if ( $sidebar->isEmpty() ) {
            return notFound('可用左边栏列表为空');
        }
        return success($sidebar->toArray());
    }

}